<html>
<head>
    <title>test</title>
    <script type="text/javascript" src="logger.js"></script>
</head>
<body>
    <script type="text/javascript">
        var loggerLabels = ['dev', 'qa', 'prod'];
        var Loggers = {};
        for (var i in loggerLabels) {
            var label = loggerLabels[i];
            Loggers[label] = new Logger({formatter: Logger.formatters.DefaultLogFormatter({label: label})});
        }
        Loggers.dev.log('asd');
        Loggers.qa.log(123);
        Loggers.prod.log({a:1,b:{c:1,d:1,e:{f:1,g:1}}});

        // register an object 
        var a = {};
        Logger.register(a);
        a.log('aaa');
        
        // register an object instance
        function B() {
          Logger.register(this);
        };
        
        B.prototype.abc = function() {
          this.log('bbb');
        };
        
        var b = new B();
        b.log('bbbbbb');
        b.abc();
        
        // register a whole class of objects
        function C() {};
        Logger.register(C);
        var c = new C();
        c.log('ccc');
        
    </script>
</body>
</html>
